/*
 * @Author: LJH003 13179754+ljh003@user.noreply.gitee.com
 * @Date: 2025-05-29 23:51:20
 * @LastEditors: LJH003 13179754+ljh003@user.noreply.gitee.com
 * @LastEditTime: 2025-06-18 21:40:29
 * @FilePath: \ai-assistant-admin\src\api\userApiKey.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'
import type {
  UserApiKey,
  ApiKeyPageParams,
  ApiKeyPageResponse,
  ApiKeyUpdateParams,
  ApiResponse
} from '@/types/apikey'

/**
 * 分页查询用户API密钥
 * @param params 查询参数
 */
export function getUserApiKeyPage(params: ApiKeyPageParams) {
  return request.post<ApiResponse<ApiKeyPageResponse>>('/userApiKey/page', params)
}

/**
 * 获取用户API密钥详情
 * @param id API密钥ID
 */
export function getUserApiKeyDetail(id: number) {
  return request.get<ApiResponse<UserApiKey>>(`/userApiKey/get/${id}`)
}

/**
 * 修改用户API密钥
 * @param data 更新数据
 */
export function updateUserApiKey(data: ApiKeyUpdateParams) {
  return request.post<ApiResponse<null>>('/userApiKey/update', data)
} 